package com.sirui.cloud.identity.domain;

public class MsgDto<T> {

	private Integer status;
	private String msg;
	private T data;

	private static final int SUCC = 1;
	private static final int FAIL = 2;

	private static final String SUCC_MSG = "operation successful";

	public static <T> MsgDto<T> getSucc() {
		return new MsgDto<T>(SUCC, SUCC_MSG, null);
	}

	public static <T> MsgDto<T> getSucc(T data) {
		return new MsgDto<T>(SUCC, SUCC_MSG, data);
	}

	public static <T> MsgDto<T> getFail(String msg) {
		return new MsgDto<T>(FAIL, msg, null);
	}

	private MsgDto(Integer status, String msg, T data) {
		super();
		this.status = status;
		this.msg = msg;
		this.data = data;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public T getData() {
		return data;
	}

	public void setData(T data) {
		this.data = data;
	}

}
